home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-12-13 | 7.1 KB | 217 lines | [TEXT/ttxt] |
- language: infix-dylan
- module: Online-Insultant
-
- /* Copyright (C) 1994, Apple Computer, Inc. All rights reserved. */
-
- /* CREATE YOUR OWN SHAKESPEAREAN INSULTS by Jerry Maguire, who teaches
- * English at Center Grove High School in Greenwood, Indiana.
- *
- * Combine one word from each of the three columns below, preface with "Thou"
- * and thus shalt thou have the perfect insult. Let thyself go--mix and
- * match to find a barb worthy of the Bard!
- */
-
- define constant column-A = #("artless",
- "bawdy",
- "beslubbering",
- "bootless",
- "churlish",
- "cockered",
- "clouted",
- "craven",
- "currish",
- "dankish",
- "dissembling",
- "droning",
- "errant",
- "fawning",
- "fobbing",
- "froward",
- "frothy",
- "gleeking",
- "goatish",
- "gorbellied",
- "impertinent",
- "infectious",
- "jarring",
- "loggerheaded",
- "lumpish",
- "mammering",
- "mangled",
- "mewling",
- "paunchy",
- "pribbling",
- "puking",
- "puny",
- "quailing",
- "rank",
- "reeky",
- "roguish",
- "ruttish",
- "saucy",
- "spleeny",
- "spongy",
- "surly",
- "tottering",
- "unmuzzled",
- "vain",
- "venomed",
- "villainous",
- "warped",
- "wayward",
- "weedy",
- "yeasty");
-
- define constant column-B = #("base-court",
- "bat-fowling",
- "beef-witted",
- "beetle-headed",
- "boil-brained",
- "clapper-clawed",
- "clay-brained",
- "common-kissing",
- "crook-pated",
- "dismal-dreaming",
- "dizzy-eyed",
- "doghearted",
- "dread-bolted",
- "earth-vexing",
- "elf-skinned",
- "fat-kidneyed",
- "fen-sucked",
- "flap-mouthed",
- "fly-bitten",
- "folly-fallen",
- "fool-born",
- "full-gorged",
- "guts-griping",
- "half-faced",
- "hasty-witted",
- "hedge-born",
- "hell-hated",
- "idle-headed",
- "ill-breeding",
- "ill-nurtured",
- "knotty-pated",
- "milk-livered",
- "motley-minded",
- "onion-eyed",
- "plume-plucked",
- "pottle-deep",
- "pox-marked",
- "reeling-ripe",
- "rough-hewn",
- "rude-growing",
- "rump-fed",
- "shard-borne",
- "sheep-biting",
- "spur-galled",
- "swag-bellied",
- "tardy-gaited",
- "tickle-brained",
- "toad-spotted",
- "unchin-snouted",
- "weather-bitten");
-
- define constant column-C = #("apple-john",
- "baggage",
- "barnacle",
- "bladder",
- "boar-pig",
- "bugbear",
- "bum-bailey",
- "canker-blossom",
- "clack-dish",
- "clotpole",
- "coxcomb",
- "codpiece",
- "death-token",
- "dewberry",
- "flap-dragon",
- "flax-wench",
- "flirt-gill",
- "foot-licker",
- "fustilarian",
- "giglet",
- "gudgeon",
- "haggard",
- "harpy",
- "hedge-pig",
- "horn-beast",
- "hugger-mugger",
- "jolthead",
- "lewdster",
- "lout",
- "maggot-pie",
- "malt-worm",
- "mammet",
- "measle",
- "minnow",
- "miscreant",
- "moldwarp",
- "mumble-news",
- "nut-hook",
- "pigeon-egg",
- "pignut",
- "puttock",
- "pumpion",
- "ratsbane",
- "scut",
- "skainsmate",
- "strumpet",
- "varlot",
- "vassal",
- "whey-face",
- "wagtail");
-
- define constant random-element = method(sequence)
- sequence[random-integer(size(sequence))];
- end method;
-
- // This is the entry point
- define constant random-insult = method()
- concatenate("Thou ", random-element(column-A), " ",
- random-element(column-B), " ",
- random-element(column-C), "!");
- end method;
-
- // Import interfaces for random number generator
- define interface
- #include "QuickDraw.h",
- import: {"Random" => Random-16-bit};
- struct "QDGlobals" => <QDGlobals>,
- import: {"randSeed" => QDGlobals$randSeed};
- #include "LowMem.h",
- import: {"LMGetCurrentA5", "LMGetRndSeed"};
- end interface;
-
- // Initialize the random number generator according to Inside Mac I-195
- define constant randomize = method()
- let QDGlobals :: <QDGlobals> = as(<QDGlobals>, pointer-at(LMGetCurrentA5())
- - structure-size(<QDGlobals>) + 4);
- QDGlobals$randSeed(QDGlobals) := LMGetRndSeed();
- #t
- end method;
-
- randomize();
-
- // An integer >= 0 and < upper-bound
- // Apparently the framework exports a function to do this now
- // but I felt like keeping my own definition
- define constant random-integer = method(upper-bound :: <integer>)
- => random-integer :: <integer>;
- local method random-bits(accumulator, have, need)
- if (have >= need) accumulator
- else random-bits(ash(accumulator, 16) + Random-16-bit(),
- ash(have, 16),
- need);
- end if;
- end method;
- let bits = case
- upper-bound < 2 ^ 16 => Random-16-bit();
- upper-bound < 2 ^ 32 => Random-16-bit() + ash(Random-16-bit(), 16);
- otherwise => random-bits(0, 1, upper-bound);
- end case;
- modulo(bits, upper-bound);
- end method;
-